import { createApp } from 'vue'
import Antd from 'ant-design-vue'
import App from './App.vue'
import router from './router' // 路由
import { pinia } from './store' // store
import { directiveFun } from './utils/util' // 自定义指令
import 'ant-design-vue/dist/reset.css'
import './style.css' // 全局 css
import 'vant/lib/index.css';
import 'vant/es/image-preview/style';
import 'vant/es/toast/style';
import { Icon } from 'vant'
const app = createApp(App)

function setRemUnit() {
    const docEl = document.documentElement;
    let rem = docEl.clientWidth / 10; // 将屏幕宽度等分为 10 份，每份为 1rem
    docEl.style.fontSize = rem + 'px';
}
setRemUnit();
window.addEventListener('resize', setRemUnit); // 当窗口大小改变时，重新计算 rem 的大小
directiveFun(app)
app.use(router)
app.use(pinia)
app.use(Antd)
app.use(Icon);
app.mount('#app')